﻿using System;

namespace NFox.Pycad.Core.Modules
{
    public class lockdoc : IDisposable
    {

        private bool _islock;
        private dynamic _doclock;

        public lockdoc(dynamic doc, bool islock = true)
        {
            if (_islock = islock)
                _doclock = doc?.LockDocument();

        }

        public void Dispose()
        {
            if (_islock && _doclock != null)
                _doclock.Dispose();
        }
    }
}

